package cn.stylefeng.guns.modular.web.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageFactory;
import cn.stylefeng.guns.core.ParamUtil;
import cn.stylefeng.guns.modular.web.service.ISmPlanService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 * 描述：存钱打卡计划表 controller
 * 作者：chenhuiyan
 * 时间：2020-04-18
 */
@Controller
@RequestMapping("/web/smPlan")
public class SmPlanController extends BaseController {

    private String PREFIX = "/modular/web/smPlan/";

    @Autowired
    private ISmPlanService smPlanService;

    /**
     * 跳转到管理首页
     */
    @RequestMapping(value = "")
    public String index() {
        return PREFIX + "smPlan.html";
    }

    /**
     * 获取列表
     */
    @RequestMapping(value = "/list")
    @ResponseBody
    public Object list() {
        Map<String, Object> params = ParamUtil.getParams();
        Page<Map<String, Object>> list = smPlanService.list(params);
        return LayuiPageFactory.createPageInfo(list);
    }

}
